; load DH sectors to ES:BX from drive DL

disk_read:
pusha
push	dx		; store this so we can recall it later

mov	ah,	0x02	; bios disk read function
mov	al,	dh	; read dh sectors
mov	dh,	0x00	; head 0
mov	ch,	0x00	; cylinder 0
mov	cl,	0x02	; sector 2 (1-indexed, boot sector is 1 so 2 is the next one)

int	0x13		; read the disk
jc	disk_error	; jump if carry flag is set, which is set by bios if there is an error

pop	dx		; restore this so we know how much data we expected
cmp	dh,	al	; al = sectors read, dh = sectors expected
jne	disk_error

popa
ret

disk_error:
mov	bx,	disk_error_msg
call	print_string
jmp 	$

disk_error_msg:
db	"Disk Read Error!",0
